package com.itheima.service.impl;


import com.itheima.mapper.EmpMapper;
import com.itheima.pojo.JobOption;
import com.itheima.service.EmpService;
import com.itheima.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ReportSerivceimp implements ReportService {
    @Autowired
   private EmpMapper empMapper;
    @Override
    public JobOption getEmpJobData() {
        //调用maper接口
        List<Map<String, Object>> list = empMapper.countEmpJobData();

       List<Object> joblist =  list.stream().map(dataMap -> dataMap.get("pos")).toList();

        List<Object> datalist =  list.stream().map(dataMap -> dataMap.get("num")).toList();

        return new JobOption(joblist,datalist);
    }

    @Override
    public List<Map<String, Object>> getEmpGenderData() {
       return  empMapper.countEmpGenderData();
    }
}
